using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;

/**
*@file       PSObject_DisappearReciever.cs
*@brief      process message PSObject_Disappear
*
*@author     graywind
*@version    1.0.0.1
*@data       2012/4/23
*/

//process PSObject_Disappear
public class OnPSObject_Disappear
{
    /// <summary>
    /// process message
    /// </summary>
    /// <param name="op">message operator</param>
    /// <param name="session_id">session identifier</param>
    /// <param name="msg_buffer">message buffer</param>
    /// <param name="msg_bytes">buffer length</param>
    public static void OnMapping(IMessageOperator op, Int32 session_id, byte[] msg_buffer, UInt32 msg_bytes)
    {
        //TODO
		posserver.ObjectDisappear objDisappear = ProtoNet<posserver.ObjectDisappear>.CreateFromBytes(msg_buffer, msg_bytes);

        PosWorld posWorld = op.WorldManager.Get(objDisappear.WorldId);
        if (posWorld != null)
            posWorld.Remove(objDisappear.ObjectId);
    }
}

//register callback
partial class MessageProcTypes<ProcType, MessageProc>
{
        [MessageProcType((int)PosServerTypes.MessageType.PSObject_Disappear)]
        public static PosServerProcessor.PosServerTabFunc PSObject_DisappearProc = new PosServerProcessor.PosServerTabFunc(OnPSObject_Disappear.OnMapping);
}
